/* eslint-disable @typescript-eslint/no-empty-object-type */

// import axios from 'axios';
import { baseRequestClient, requestClient } from '#/api/request';

export namespace QcindexApi {
  export interface qcindexListParams {
    pageNum: number;
    pageSize: number;
  }
  export interface Params {}
  export interface Row {
    searchValue: null;
    createBy: string;
    createTime: string;
    updateBy: string;
    updateTime: null;
    remark: string;
    params: Params;
    indexId: number;
    indexCode: string;
    indexName: string;
    indexType: string;
    qcTool: null;
    qcResultType: string;
    qcResultSpc: null | string;
    attr1: null;
    attr2: null;
    attr3: number;
    attr4: number;
  }
  export interface qcindexListResult {
    total: number;
    rows: Row[];
    code: number;
    msg: string;
  }
}

// 获取缺陷列表
export const getQcindexList = (data: QcindexApi.qcindexListParams) => {
  return requestClient.get<QcindexApi.qcindexListResult>(
    '/mes/qc/qcindex/list',
    { params: data },
  );
};

// 增加缺陷
export const addQcindex = (data: QcindexApi.Row) =>
  requestClient.post<QcindexApi.qcindexListResult>('/mes/qc/qcindex', data);

// 删除缺陷
export const deleteQcindex = (id: string) =>
  requestClient.delete<QcindexApi.qcindexListResult>(`/mes/qc/qcindex/${id}`);

// 修改缺陷
export const updateQcindex = (data: QcindexApi.Row) =>
  requestClient.put<QcindexApi.qcindexListResult>('/mes/qc/qcindex', data);

// 获取自动生成编码
export const getQcindexCode = () =>
  baseRequestClient.get<any>('/system/autocode/get/QC_INDEX_CODE');
